package service.impl;

import entity.PatientsInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import repository.PatientsInfoRepository;
import service.PatientsInfoService;

import java.util.List;

@Service
public class PatientsInfoServiceImpl implements PatientsInfoService {

    @Autowired
    private PatientsInfoRepository patientsInfoRepository;

    public Integer save(Object o) {
        PatientsInfo patientsInfo = (PatientsInfo) o;
        return patientsInfoRepository.save(patientsInfo);
    }

    public List findAll() {
        return patientsInfoRepository.findAll();
    }

    public void delete(Integer id) {
        patientsInfoRepository.delete(id);
    }

    public Integer update(Object o) {
        PatientsInfo patientsInfo = (PatientsInfo) o;
        patientsInfoRepository.saveOrUpdate(patientsInfo);
        return patientsInfo.getId();
    }
}
